package livingarea.actions_impl;

import livingarea.Members.AreaMember;
import livingarea.Members.Greenery;
import livingarea.actions.DethType;

/**
 *
 * @author Muzalevskiy Vitaliy
 */
public class GreeneryDeath implements DethType {

    
    /**<code> Beast </code> object that delegate object of current class.*/
    private AreaMember member;
    
    /**
     * Constructor for current class.
     *
     * @param beast - <code> Beast </code> object that delegate object of 
     *      current class.
     */
    public GreeneryDeath(AreaMember member){
        this.member = member;
    }

    /**
     * Current method make predator beast to die after specified number of
     * iterations.
     */
    
    @Override
    public void die() {
        if(member.getLifeCount() == Greenery.DEATH_TIME){
            member.getLivingArea().removeMember(member);
         member.getLivingArea().getStatistics().decreaseGreeneryCount();
         member.getLivingArea().getStatistics().increaseDieCount();
        }  
    }
    
}
